package com.steerinfo.dil.service;

import com.baomidou.mybatisplus.extension.api.R;
import com.steerinfo.dil.aspect.LogAspect;
import com.steerinfo.dil.feign.AmsFeign;
import com.steerinfo.dil.feign.RmsFeign;
import com.steerinfo.dil.feign.TmsFeign;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;


@Service
public class ScheduledService {

    static final Logger log = Logger.getLogger(ScheduledService.class);

    @Autowired
    private TmsFeign tmsFeign;

    @Autowired
    private RmsFeign rmsFeign;

    @Autowired
    private AmsFeign amsFeign;

    /**
     * 以下是TMS部分
     */
    @Scheduled(fixedDelay = 1000*60)
    public void signInExpireCheck(){
        Map<String, Object>  result = tmsFeign.signInExpireCheck();
        log.info("signInExpireCheck:"+result);
    }

    /**
     * 以下是RMS部分
     */
    @Scheduled(fixedDelay = 1000*60*60*24)
    public void checkCapacityLicence(){
        Map<String, Object>  result = rmsFeign.checkCapacityLicence();
        log.info("checkCapacityLicence:"+result);
    }

    @Scheduled(cron = "0 30 2 * * ? ")
    public void taskFixedNeeds(){
        Map<String, Object> result = amsFeign.taskFixedNeeds();
        log.info("taskFixedNeeds:"+result);
    }
}
